<template>
<slot :controller="controller" :store="store" :model="model">
    <AppBasisViewLayout :class="classNames" :openType="openType">
        <template #default>
            <div class="app-wf-redirect-view-content">
                <img src="/assets/img/redirect.svg" />
                <div class="context">页面跳转中~</div>
            </div>
        </template>
    </AppBasisViewLayout>
</slot>
</template>
<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@APPWFREDIRECTVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppBasisViewLayout } from "@components/layout/basis-view-layout";
import { useProps, useBasic, useAction, useController } from './app-wf-redirect-view-hook';
import { IEvent, AppWFRedirectViewActionType, IAppWFRedirectViewAbility, IAppWFRedirectViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: AppWFRedirectViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: IAppWFRedirectViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: IAppWFRedirectViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
